const mongoose = require('mongoose')
const config = require('../config/default')

/**
 * 连接
 */
mongoose.connect(config.DB_URL);

/**
  * 连接成功
  */
mongoose.connection.on('connected', function () {    
  console.log('Mongoose 连接成功: ' + config.DB_URL);  
});

/**
 * 连接异常
 */
mongoose.connection.on('error',function (err) {    
  console.log('Mongoose 连接异常: ' + err);  
});

/**
 * 连接断开
 */
mongoose.connection.on('disconnected', function () {    
  console.log('Mongoose 连接断开');
  // mongoose.connect(config.DB_URL);
});
